package com.sunnypower.rushfitapp;


import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

import com.sunnypower.rushfitapp.entity.User;
import com.sunnypower.rushfitapp.util.GetData;
import com.sunnypower.rushfitapp.util.MyImageView;
import com.sunnypower.rushfitapp.util.Saveuserinfo;


public class VipCheckActivity extends AppCompatActivity implements View.OnClickListener{
    private User user = new User();
    private String Vipstate = "会员已过期";
    private Button backmain;
    private MyImageView imgQR;
    private TextView viptime;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.rushfit_vipcheck);
        init();
    }

    private void init() {
        Intent intent = getIntent();
        user.setTel(intent.getStringExtra("tel"));
        user.setState(intent.getIntExtra("state", 0));
        user.setName(intent.getStringExtra("name"));
        user.setUid(Integer.valueOf(intent.getStringExtra("uid")));
        user.setTime(intent.getStringExtra("time"));
        System.out.println(user.toString());
        if (user.getState() == 1) {
            Vipstate = "会员有效";
        }
//        img_notice = findViewById(R.id.img_notice);
//        img_notice.setImageBitmap(R.drawable.background);
        imgQR = findViewById(R.id.vipQR);
        viptime = findViewById(R.id.viptime);
        backmain =  findViewById(R.id.backmain);
        imgQR.setImageURL("https://api.qrserver.com/v1/create-qr-code/?size=150x150&data="
                + "\n  用户编号:" + user.getUid()+"\n"
                + "\n  用户名称:" + user.getName()
                + "\n  用户电话:" + user.getTel()
                + "\n  用户状态:" + Vipstate);
        viptime.setText("于 "+user.getTime()+" 过期");
        backmain.setOnClickListener(this);

    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.backmain:
                finish();
                break;
        }
    }
}
